﻿using Nimbus1._0Platform;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using WeatherStationSys.Interface;
using WeatherStationSys.UI;

namespace WeatherMonitoringSystem
{
    public class WeatherStation
    {
        public WeatherStation()
        {
            StationTookit st = new Nimbus1_0StationTookit();

            //第4版调度器
            //把读取速率又放回具体硬件平台传感器内部
            AlarmClock ac = new AlarmClock(st);
            //ac.AlarmClockImp.StartScheduler();

            #region 午夜通知
            {
                IHiLoData tempHiloData = new TemperatureHiloDataProxy(st, ac, "Temp", DateTime.Now, -1, 123456);
                Task.Run(() =>
                {
                    while (true)
                    {
                        DateTime now = DateTime.Now;
                        //是否午夜时分
                        bool isMidnight = true;//now.TimeOfDay.ToString() == "00:00:00" ? true : false;
                        if (isMidnight)
                        {
                            ac.Wakeup();
                        }
                        Thread.Sleep(2000);
                    }
                });
            }
            #endregion

            //温度
            //TemperatureSensor ts = new TemperatureSensor(ac, st);
            //气压
            //BarometricPressureSensor bps = new BarometricPressureSensor(ac, st);
        }
    }
}
